import junit.framework.TestCase;
import org.junit.Test;
import java.lang.*;
import java.util.Arrays;
public class ComplexTest extends TestCase {
    String str = "zyz is xinzhou huge";
    String str2 = "zyz:is:xin:zhou:hu:ge";
    String[] str3 = new String[]{  "1", "7", "5", "2", "0", "4"};
    double str4[] = {2.0, 1.7, 5.2, 0.4, 66.6};
    @Test     public void testcharAt() throws Exception {
        assertEquals('z', Complex.getcharAt(str,0));
        assertEquals('y', Complex.getcharAt(str,1));
        assertEquals('z', Complex.getcharAt(str,2));
        assertEquals('h', Complex.getcharAt(str,15));
        assertEquals('g', Complex.getcharAt(str,17));
    }
    @Test     public void testsplit() throws Exception {
        assertEquals("zyz", Complex.getsplit(str2)[0]);
        assertEquals("hu", Complex.getsplit(str2)[4]);
        assertEquals("ge", Complex.getsplit(str2)[5]);
    }
    @Test     public void testgetsort() throws Exception {
        //ArraysTest(str3);
        assertEquals("5", Complex.getsort(str3)[4]);
        assertEquals("2", Complex.getsort(str3)[2]);
        assertEquals("0", Complex.getsort(str3)[0]);
        assertEquals("4", Complex.getsort(str3)[3]);
    }
    @Test
    public void testgetbinarySearch() throws Exception {
        //ArraysTest2(str4);
        assertEquals(2, Arrays.binarySearch(Complex.getbinarySearch(str4), 2.0));
        assertEquals(0, Arrays.binarySearch(Complex.getbinarySearch(str4), 0.4));
        assertEquals(4, Arrays.binarySearch(Complex.getbinarySearch(str4), 66.6));
    }
    }
